---@class BuffEffect21 : BaseBuffEffect
BuffEffect21 = ClientFight.CreateClass("BuffEffect21", ClientFight.BaseBuffEffect)
local t = BuffEffect21
t.BUFF_EFFECT_PARAMETERS_21_ = "BUFF_EFFECT_PARAMETERS_21_"
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = { ... }
    if buff.effectParams[t.BUFF_EFFECT_PARAMETERS_21_ .. buff.modelId] then
            --还是需要用代码另外控制一下只触发一次 否则可能导致死循环
        return IBuffEffect.REMOVE;
    end

    local fighter = buff.target
    if (fighter.hp < 0) then
        fighter:setHp(0);
    end
    buff.effectParams[t.BUFF_EFFECT_PARAMETERS_21_ .. buff.modelId] = os.time()

    if (buff.buffBean.f_BuffEffectValue[1] > 0) then
        DamageManager.setFighterHp(fight, fighter, fighter, nil, 0,
        buff.buffBean.f_BuffEffectValue[1] - fighter.hp, buff.buffBean.f_BuffEffectValue[1], false, true, false,false);
    elseif (buff.buffBean.f_BuffEffectValue[2] > 0) then
        local maxHp = FighterAttributeManager.getFightAttr(fighter, FighterAttributeEnum.HP);
        local hp = maxHp * buff.buffBean.f_BuffEffectValue[2] / Global.TEN_THOUSANDTH;
        DamageManager.setFighterHp(fight, fighter, fighter, nil, 0, hp - fighter.hp, hp, false, true, false,false);
    end
   -- LogUtil.info( "[" .. fight.frame .. "][EFFECT]Fighter " .. fighter.fighterId .. " Buff" .. " 触发锁血buff");
    return ClientFight.BaseBuffEffect.action(self,fight, buff, parameters);
end

t.New()